var optionsManager = new function() {
	this.saveOptionForm = function() {
		localStorage['nt_active'] = $('#notification_active').val();
		localStorage['nt_frequency'] = $('#notification_frequency').val();
		localStorage['nt_delay'] = $('#notification_delay').val();
		localStorage['nt_type'] = $('#notification_type').val();
		
		popupManager.finish();
	}
	
	this.fillOptionForm = function() {
		$('#notification_active').val(this.getNotificationActive());
		$('#notification_frequency').val(this.getNotificationFrequency());
		$('#notification_delay').val(this.getNotificationDelay());
		
		$("#notification_type [value='" + this.getNotificationType() + "']").attr("selected", "selected");
	}
	
	this.getNotificationActive = function() {
		return JSON.parse(localStorage['nt_active']);
	}
	
	this.getNotificationFrequency = function() {
		var frequency = JSON.parse(localStorage['nt_frequency']);
		if (!frequency) 
			frequency = 60;
		
		return frequency;
	}
	
	this.getNotificationDelay = function() {
		var delay_val = JSON.parse(localStorage['nt_delay']);
		
		if (!delay_val)
			delay_val = 3;

		return delay_val;
	}
	
	this.getNotificationType = function () {
		var type = JSON.parse(localStorage['nt_type']);
		return type;
	}	
	
	return this;
}